//
//  FlagshipModel.m
//  UI19 - Car(汽车之家)
//
//  Created by 韩旭 on 16/8/9.
//  Copyright © 2016年 lanou. All rights reserved.
//

#import "FlagshipModel.h"

@implementation FlagshipModel

- (void)setValue:(id)value forUndefinedKey:(NSString *)key {
    if ([key isEqualToString:@"id"]) {
        self.ID = (NSInteger)value;
    }
    
}
- (instancetype)initWithDic:(NSDictionary *)dic {
    self = [super init];
    if (self) {
        [self setValuesForKeysWithDictionary:dic];
    }return self;
}
+ (instancetype)flagshipWithDic:(NSDictionary *)dic {
    return [[FlagshipModel alloc] initWithDic:dic];
}

+ (NSArray *)groupsArrAll {
    NSString *path = [[NSBundle mainBundle] pathForResource:@"FlagshipJSON" ofType:@"json"];
    NSMutableArray *arrAll = [NSMutableArray array];
    NSData *data = [NSData dataWithContentsOfFile:path];
 NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
    NSDictionary *dicResult = dic[@"result"];
    NSArray *list = dicResult[@"list"];
    for (NSDictionary *dic in list) {
        [arrAll addObject:[FlagshipModel flagshipWithDic:dic]];
    }
    return arrAll;
}
@end
